package concurrency;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		//Thread th = new Thread(new ThreadTest(),"ThreadTest Thread");
		for (int i = 0; i < 5; i++)
			new Thread(new ThreadTest(),"ThreadTest Thread: "+i).start();
		
		//th.start();
		
		System.out.println("After run()");

	}

}

class ThreadTest implements Runnable{
	
	public ThreadTest() {
		System.out.println("Creating ThreadTest object");
	}

	@Override
	public void run() {
		//System.out.println(Thread.currentThread().getName());
		
		System.out.println("Message 1 in run(): "+Thread.currentThread().getName());
		Thread.yield();
		
		System.out.println("Message 2 in run(): "+Thread.currentThread().getName());
		Thread.yield();
		
		System.out.println("Message 3 in run(): "+Thread.currentThread().getName());
		Thread.yield();
	}
	
}
